window.sql = window.sql || {};
(function (ms, dbCfg) {


    var sqlite = window.sqlite || window.top.sqlite;


    //校验
    ms.validataFile = function (filename, successCallback, failCallback, bfb) {
        sqlite.validataFile(filename, successCallback, failCallback, bfb);
    };

    //查询
    ms.selectBysql = function (sql, args, successCallback, failCallback) {
        sqlite.selectBysql(sql, args, successCallback, failCallback);
    };
    ms.all = function(sql,callback){
        sqlite.all(sql,callback);
    };
    ms.updateBysql = function (sql, args, successCallback, failCallback) {
        sqlite.updateBysql(sql, args, successCallback, failCallback);
    };
    //更新或者删除
    /****
     * data {key:value}
     */
    ms.insertBysql = function (tableName, data, successCallback, failCallback) {
        //需要处理 args
        sqlite.insertBysql(tableName, data, successCallback, failCallback);
    };

    /****
     *
     * 分页查询
     */
    ms.pageBysql = function (cfg) {

        sqlite.pageBysql(cfg);

    };
    /***
     * 批量保存
     */
    ms.insertBatch = function (tbl, datas, successCallback, failCallback) {
        sqlite.insertBatch(tbl, datas, successCallback, failCallback);
    };
    ms.sqlBatch = function (tbl, datas, successCallback, failCallback) {
        sqlite.sqlBatch(tbl, datas, successCallback, failCallback);
    };
    ms.serializeSql = function (sqls, successCallback) {
        sqlite.serializeSql(sqls, successCallback);
    };
    ms.serialize = function (sqlFunction, successCallback, failCallback) {
        sqlite.serialize(sqlFunction, successCallback, failCallback);
    };


    //数据库的打开
    ms.open = function (callback) {
        return sqlite.open(callback);
    };
    //关闭数据库连接
    ms.close = function (db) {
        sqlite.close(db);
    };
})(window.sql);

window.db = window.sql;
